# -*- coding: utf-8 -*-
# author:WS
# time:2022/1/06/16:18:10
# ___msg___ = '筛选<专利检索及分析系统>与<中国及多国>中不一样专利数据'

from quote_folder.Db_connect import DB_connect


class quchong:
    def __init__(self):
        self.bigdata_con = DB_connect().online_big_data()  # 数据组数据库连接
        self.bigdata_cur = self.bigdata_con.cursor()

    def get_db_data(self):
        """获取数据库中数据"""
        select_sql = f'''select application_number from patent_table where key_word="武汉市中心医院"'''  # 获取数据库中的申请号
        self.bigdata_con.commit()
        self.bigdata_cur.execute(select_sql)
        List_sqh = self.bigdata_cur.fetchall()
        li_sqh = []
        for item in List_sqh:
            sqh = item[0]
            li_sqh.append(sqh)
        # print(li_sqh)
        self.judge(li_sqh)

    def judge(self, db_sqh):
        """判断<中国及多国专利系统>获取的专利数据与<专利检索及分析系统>获取的数据的不同数据"""
        with open("select_sqh.txt", "r") as country_sqh:
            for item2 in country_sqh:
                sqh = "CN" + item2.strip()[:-1] + "." + item2.strip()[-1]
                if sqh not in db_sqh:
                    print(item2.strip())


if __name__ == '__main__':
    quchong().get_db_data()
